﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySearch;

public partial class wuc_TicketDetailForCreate : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    public void SetTicketDetailsForView(Ticket ticket)
    {
        this.hfChargeableCode.Value = ticket.ChargeableCode;
        this.hfProfileCode.Value = ticket.ProfileCode;
        this.TicketNoLabel.Text = ticket.TicketNo;
        this.TicketStatusLabel.Text = ticket.Status.ToString();

        //IList<TicketData> lstData = TicketOM.ListTicketData(ticket.TicketNo);
        //this.ServiceTemplateEditable.BindData(ticket.TicketNo, ticket.TypeCode, ticket.VerNo, ticket.ChargeableCode, ticket.ProfileCode);
    }

    public void SetTicketDetailsForCreate(string serviceTypeCode, string profileCode, string chargeableCode)
    {
        this.hfChargeableCode.Value = chargeableCode;
        this.hfProfileCode.Value = profileCode;
        //ServiceType st = ServiceTemplateOM.GetServiceType(serviceTypeCode);
        //if(st != null)
        //{
        //    this.lblServiceTypeDesc.Text = st.Description;
        //    ServiceCategory sc = ServiceTemplateOM.GetServiceCategory(st.CategoryCode);
        //    this.lblCategoryDesc.Text = sc == null ? "" : sc.Description;
        //}
        
        //int verNo = ServiceTemplateOM.GetServiceType(serviceTypeCode).CurrentVersion;
        //this.ServiceTemplateEditable.BindData("", serviceTypeCode, verNo, chargeableCode, profileCode);
    }

    //public IList<TicketData> GetTicketData()
    //{
    //    //wuc_TicketProfileForUser ticketProfile = this.Parent.FindControl("TicketProfileForUser") as wuc_TicketProfileForUser;

    //    IList<TicketData> result = this.ServiceTemplateEditable.GetTicketData();
    //    result.Add(new TicketData() { QuesCode = "TICKET_ATTR_STARTDATE", Answer = this.startDateDatePicker.GetSelectedDate() });
    //    //result.Add(new TicketData() { QuesCode = "TICKET_ATTR_DUEDATE", Answer = this.endDateDatePicker.GetSelectedDate() });        
    //    result.Add(new TicketData() { QuesCode = "SCREEN_ATTR_READY_DATE", Answer = this.readyDateDatePicker.GetSelectedDate() });

    //   // if (ticketProfile != null && !String.IsNullOrEmpty(ticketProfile.GetPrimaryContact()))
    //    //    result.Add(new TicketData() { QuesCode = "SCREEN_ATTR_PRI_CONTACT", Answer = ticketProfile.GetPrimaryContact() });
    //    return result.OrderBy(x => x.QuesCode).ToList();
    //}
}